package com.tangyuan.user.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tangyuan.model.UserAction;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 小梁
 * @since 2020-12-03
 */
@Mapper
public interface UserActionMapper extends BaseMapper<UserAction> {

    @Update("TRUNCATE `user_action`")
    void deleteAll();

    /**
     * 查看相邻用户看过的视频并且自己没有看过
     * @param userId 用户ID
     * @param userIds 相邻用户ID
     * @return
     */
    List<Long> getUserActionByUserIdDto(
            @Param("userId") Long userId,
            @Param("userIds") List<Long> userIds,
            @Param("justScore") BigDecimal justScore,
            @Param("loseScore") BigDecimal loseScore);

    List<UserAction> getYesterdayUserActionData(Date time);

    List<Long> getUserActionByUserId(Long userId);
}
